CRC Any
To compute CRC values by providing the length of bits, expression, reflection, an initial value and a final xor value. It has built-in CRC-8-ATM, CRC-8-CDMA, CRC-16-IBM, CRC16-CCITT, CRC-32-IEEE, CRC-32-C, CRC-64-ISO and CRC-64-ECMA functions.
Usage
You can use create_crc
associated function to create a CRC instance by providing the length of bits, expression, reflection, an initial value and a final xor value. For example, if you want to compute a CRC-24 value.
extern crate crc_any;
use CRC;
let mut crc24 = CRC create_crc;
crc24.digest;
assert_eq!;
To simplify the usage, there are several common versions of CRC whose computing functions are already built-in.
- crc8(crc8atm)
- crc8cdma
- crc16(crc16ibm)
- crc16ccitt(crcccitt)
- crc32(crc32ieee, also called crc32b in
mhash
) - crc32mhash
mhash
is a common library which has two weird versions of CRC32 calledcrc32
andcrc32b
.crc32
andcrc32mhash
in this module arecrc32b
andcrc32
in mhash respectively.
- crc32c
- crc64(crc64ecma)
- crc64iso
For instance,
extern crate crc_any;
use CRC;
let mut crc64ecma = CRC crc64ecma;
crc64ecma.digest;
assert_eq!;
After getting a CRC value, you can still use the digest
method to continue computing the next CRC values.
Crates.io
https://crates.io/crates/crc-any